FROM golang:alpine AS baseImage
LABEL stage=gobuilder

ENV CGO_ENABLED 0
ENV GOPROXY https://goproxy.cn,direct
RUN mkdir -p /var/www/
COPY .. /var/www/
#WORKDIR /var/www/${APP_NAME}
WORKDIR /var/www/project-api
RUN mkdir -p bin
RUN ls
RUN go mod download && go build -o bin/main
WORKDIR /var/www/project-api/bin
RUN cp ../config . -rf


FROM alpine:latest
#COPY --from=baseImage /var/www/app/${APP_TYPE}/${APP_NAME}/bin /app
COPY --from=baseImage /var/www/project-api/bin /app
WORKDIR /app


CMD ["./main"]